<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("#updateForm").submit(function(){
		
		var pass=$(":input[name=memberPass]").val();
		var name=$(":input[name=memberName]").val();
		var address=$(":input[name=memberAddr]").val();
		
		if(pass==""){
			alert("비밀번호를 입력해 주세요");
			return false;
		}
		if(name==""){
			alert("이름을 입력해 주세요");
			return false;
		}
		if(address==""){
			alert("주소를 입력해 주세요");
			return false;
		}
	});
});
</script>
</head>
<body>
<c:choose>
	<c:when test="${sessionScope.mvo != null }">
		<h3>회원정보수정</h3>
		<form method="post" id="updateForm" action="auth_update.do">
		아이디 : <input type="text" name="memberId" 
		value="${sessionScope.mvo.id}" readonly>
		<br>패스워드 : <input type="text" name="memberPass" 
		value="${sessionScope.mvo.password}" >		
		<br>이름 : <input type="text" name="memberName" 
		value="${sessionScope.mvo.name}" >	
		<br>주소 : <input type="text" name="memberAddr" 
		value="${sessionScope.mvo.address}" >	
		<br><input type="submit" value="회원정보수정">
		</form>
	</c:when>
	<c:otherwise>
		<script type="text/javascript">
			alert("로그인하세요!");
			location.href="index.jsp";
		</script>
	</c:otherwise>
</c:choose>	
</body>
</html>